<template>
  <el-dialog
    v-model="subordinateDialogVisible"
    title="添加下级"
    width="500px"
    class="subordinate-dialog-box"
    :before-close="CancelFUnc"
  >
    <el-form
      :model="addSubordinateForm"
      label-position="left"
      label-width="100px"
      :rules="addSubordinateRules"
    >
      <el-form-item label="下级名称" prop="name">
        <el-input class="input-box" v-model="addSubordinateForm.name" />
      </el-form-item>
      <el-form-item label="分成比例">
        <el-input
          class="input-box"
          v-model="addSubordinateForm.name"
          v-inputLimt="2"
        />
        <span>%</span>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button
          class="submit-btn"
          type="primary"
          @click="CancelFUnc"
        >
          确定
        </el-button>
        <el-button class="cancel-btn" @click="CancelFUnc">
          取消
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import {
  computed,
  watch,
  onMounted,
  getCurrentInstance,
  ref,
  defineEmits,
  nextTick,
} from 'vue'
const { proxy: that } = getCurrentInstance()
const props = defineProps({
  show: {
    type: Boolean,
    default: () => {
      return false
    },
  },
  tableData: {
    type: Array,
    default: () => {
      return []
    },
  },
})

// 添加下级
let addSubordinateForm = ref({})
let subordinateDialogVisible = ref(false)
let addSubordinateRules = ref({
  name: [{ required: true, message: '请输入名称', trigger: 'change' }],
})
watch(
  () => props.show,
  (newValue, oldValue) => {
    subordinateDialogVisible.value = props.show
  }
)
const emit = defineEmits(['onClose'])
const CancelFUnc = () => {
  emit('onClose', false)
}
const SubmitFUnc = () => {}
</script>
<style lang="scss">
@import './store_dislog.scss';
</style>